<template>
  <div>
    <h1>父组件</h1>
    <MyCom :name="name" :age="age" :happy="happy"/>
    <button @click="add">点我呀</button>
  </div>
</template>
<script>
// 导入=>注册=>使用
import MyCom from './MyCom.vue'
export default {
  data() {
    return {
      name:'张三',
      age:20,
      happy:['睡觉','吃饭']
    }
  },
  components:{
    MyCom
  },
  methods: {
    add(){
      this.name = '小明'
    }
  },
}
</script>